package gu.sql2java.wherehelper;
import java.io.Serializable;


/**
 * DeviceBean is a mapping of dc_device Table.
 * <br>Meta Data Information (in progress):
 * <ul>
 *    <li>comments: 前端设备基本信息 </li>
 * </ul>
 * @author guyadong
*/
public final class DeviceBean 
    implements Serializable,Cloneable
{
    private static final long serialVersionUID = -3495281739409382636L;

    /** comments:设备id */
    private Integer id;

    /** comments:所属设备组id */
    private Integer groupId;

    /** comments:设备组特性标志,应用层定义 */
    private Integer features;

    /** comments:设备名称,用户指定 */
    private String name;

    /** comments:设备物理地址,MAC地址,IMEI或其他设备识别码 */
    private String physicalAddress;

    /** comments:设备物理地址类型(MAC,IMEI...),默认6字节MAC地址(HEX) */
    private String addressType;

    /** comments:设备物联网卡编号,例如联通叫iccid */
    private String iotCard;

    /** comments:设备状态,ENABLE:正常,DISABLE:关闭,MAINTAIN:维护,PENDING:挂起(待审核) */
    private String status;

    /** comments:设备令牌创建的时间戳,每次创建设备令牌都会修改此字段 */
    private java.util.Date tokenTime;

    /** comments:设备屏幕信息,格式示例:15H1080x960--15(英)寸横屏分辨率1080x960,21V960x1080--21(英)寸横屏分辨率960x1080 */
    private String screenInfo;

    /** comments:操作系统名称及版本及硬件架构名称,例如:Windows-x86_64,Linux-x86_64,Android-arm... */
    private String osArch;

    /** comments:设备端应用程序的版本号,格式由应用层定义 */
    private String versionInfo;

    /** comments:设备产品型号 */
    private String model;

    /** comments:设备供应商 */
    private String vendor;

    /** comments:设备产品详细信息,以JSON格式定义设备详细信息,JSON字段:device_name(产品名称),manufacturer(制造商),made_date(生产日期),应用层可根据需要扩展 */
    private String deviceDetail;

    /** comments:JSON格式的扩展字段(最大64KB),用于定义扩展信息 */
    private String props;

    /** comments:备注 */
    private String remark;

    private java.util.Date createTime;

    private java.util.Date updateTime;

    /** columns modified flag */
    private int modified;
    /** columns initialized flag */
    private int initialized;
    /** new record flag  */
    private boolean isNew;        
    public DeviceBean(){
	    reset();
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getGroupId() {
		return groupId;
	}

	public void setGroupId(Integer groupId) {
		this.groupId = groupId;
	}

	public Integer getFeatures() {
		return features;
	}

	public void setFeatures(Integer features) {
		this.features = features;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPhysicalAddress() {
		return physicalAddress;
	}

	public void setPhysicalAddress(String physicalAddress) {
		this.physicalAddress = physicalAddress;
	}

	public String getAddressType() {
		return addressType;
	}

	public void setAddressType(String addressType) {
		this.addressType = addressType;
	}

	public String getIotCard() {
		return iotCard;
	}

	public void setIotCard(String iotCard) {
		this.iotCard = iotCard;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public java.util.Date getTokenTime() {
		return tokenTime;
	}

	public void setTokenTime(java.util.Date tokenTime) {
		this.tokenTime = tokenTime;
	}

	public String getScreenInfo() {
		return screenInfo;
	}

	public void setScreenInfo(String screenInfo) {
		this.screenInfo = screenInfo;
	}

	public String getOsArch() {
		return osArch;
	}

	public void setOsArch(String osArch) {
		this.osArch = osArch;
	}

	public String getVersionInfo() {
		return versionInfo;
	}

	public void setVersionInfo(String versionInfo) {
		this.versionInfo = versionInfo;
	}

	public String getModel() {
		return model;
	}

	public void setModel(String model) {
		this.model = model;
	}

	public String getVendor() {
		return vendor;
	}

	public void setVendor(String vendor) {
		this.vendor = vendor;
	}

	public String getDeviceDetail() {
		return deviceDetail;
	}

	public void setDeviceDetail(String deviceDetail) {
		this.deviceDetail = deviceDetail;
	}

	public String getProps() {
		return props;
	}

	public void setProps(String props) {
		this.props = props;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public java.util.Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(java.util.Date createTime) {
		this.createTime = createTime;
	}

	public java.util.Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(java.util.Date updateTime) {
		this.updateTime = updateTime;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public boolean isNew()
    {
        return this.isNew;
    }

    /**
     * Specifies to the object if it has been set as new.
     *
     * @param isNew the boolean value to be assigned to the isNew field
     */
    public void setNew(boolean isNew)
    {
        this.isNew = isNew;
    }
    /**
     * @return the modified status of columns
     */
    public int getModified(){
        return modified;
    }

    /**
     * @param modified the modified status bit to be assigned to {@link #modified}
     */
    public void setModified(int modified){
        this.modified = modified;
    }
    /**
     * @return the initialized status of columns
     */
    public int getInitialized(){
        return initialized;
    }

    /**
     * @param initialized the initialized status bit to be assigned to {@link #initialized}
     */
    public void setInitialized(int initialized){
        this.initialized = initialized;
    }

    /** reset all fields to initial value, equal to a new bean */
    public void reset(){
        this.id = null;
        /* DEFAULT:'1'*/
        this.groupId = Integer.valueOf(1);
        /* DEFAULT:'0'*/
        this.features = Integer.valueOf(0);
        this.name = null;
        this.physicalAddress = null;
        /* DEFAULT:'MAC'*/
        this.addressType = "MAC";
        this.iotCard = null;
        /* DEFAULT:'ENABLE'*/
        this.status = "ENABLE";
        /* DEFAULT:'CURRENT_TIMESTAMP'*/
        this.tokenTime = null;
        this.screenInfo = null;
        this.osArch = null;
        this.versionInfo = null;
        this.model = null;
        this.vendor = null;
        this.deviceDetail = null;
        this.props = null;
        this.remark = null;
        /* DEFAULT:'CURRENT_TIMESTAMP'*/
        this.createTime = null;
        /* DEFAULT:'CURRENT_TIMESTAMP'*/
        this.updateTime = null;
        this.isNew = true;
        this.modified = 0;
        this.initialized = 0;
    }

    @Override
    public DeviceBean clone(){
        try {
			return (DeviceBean) super.clone();
		} catch (CloneNotSupportedException e) {
			throw new RuntimeException(e);
		}
    }


    public static final Builder builder(){
        return new Builder().reset();
    }
    /** 
     * a builder for DeviceBean,the template instance is thread local variable
     * a instance of Builder can be reused.
     */
    public static final class Builder{
        /** DeviceBean instance used for template to create new DeviceBean instance. */
        static final ThreadLocal<DeviceBean> TEMPLATE = new ThreadLocal<DeviceBean>(){
            @Override
            protected DeviceBean initialValue() {
                return new DeviceBean();
            }};
        private Builder() {}
        /** 
         * reset the bean as template 
         * @see DeviceBean#reset()
         */
        public Builder reset(){
            TEMPLATE.get().reset();
            return this;
        }
        /** set a bean as template,must not be {@code null} */
        public Builder template(DeviceBean bean){
            if(null == bean){
                throw new NullPointerException();
            }
            TEMPLATE.set(bean);
            return this;
        }
        /** return a clone instance of {@link #TEMPLATE}*/
        public DeviceBean build(){
            return TEMPLATE.get().clone();
        }
        /** 
         * fill the field : dc_device.id
         * @param id 设备id
         * @see DeviceBean#getId()
         * @see DeviceBean#setId(Integer)
         */
        public Builder id(Integer id){
            TEMPLATE.get().setId(id);
            return this;
        }
        /** 
         * fill the field : dc_device.group_id
         * @param groupId 所属设备组id
         * @see DeviceBean#getGroupId()
         * @see DeviceBean#setGroupId(Integer)
         */
        public Builder groupId(Integer groupId){
            TEMPLATE.get().setGroupId(groupId);
            return this;
        }
        /** 
         * fill the field : dc_device.features
         * @param features 设备组特性标志,应用层定义
         * @see DeviceBean#getFeatures()
         * @see DeviceBean#setFeatures(Integer)
         */
        public Builder features(Integer features){
            TEMPLATE.get().setFeatures(features);
            return this;
        }
        /** 
         * fill the field : dc_device.name
         * @param name 设备名称,用户指定
         * @see DeviceBean#getName()
         * @see DeviceBean#setName(String)
         */
        public Builder name(String name){
            TEMPLATE.get().setName(name);
            return this;
        }
        /** 
         * fill the field : dc_device.physical_address
         * @param physicalAddress 设备物理地址,MAC地址,IMEI或其他设备识别码
         * @see DeviceBean#getPhysicalAddress()
         * @see DeviceBean#setPhysicalAddress(String)
         */
        public Builder physicalAddress(String physicalAddress){
            TEMPLATE.get().setPhysicalAddress(physicalAddress);
            return this;
        }
        /** 
         * fill the field : dc_device.address_type
         * @param addressType 设备物理地址类型(MAC,IMEI...),默认6字节MAC地址(HEX)
         * @see DeviceBean#getAddressType()
         * @see DeviceBean#setAddressType(String)
         */
        public Builder addressType(String addressType){
            TEMPLATE.get().setAddressType(addressType);
            return this;
        }
        /** 
         * fill the field : dc_device.iot_card
         * @param iotCard 设备物联网卡编号,例如联通叫iccid
         * @see DeviceBean#getIotCard()
         * @see DeviceBean#setIotCard(String)
         */
        public Builder iotCard(String iotCard){
            TEMPLATE.get().setIotCard(iotCard);
            return this;
        }
        /** 
         * fill the field : dc_device.status
         * @param status 设备状态,ENABLE:正常,DISABLE:关闭,MAINTAIN:维护,PENDING:挂起(待审核)
         * @see DeviceBean#getStatus()
         * @see DeviceBean#setStatus(String)
         */
        public Builder status(String status){
            TEMPLATE.get().setStatus(status);
            return this;
        }
        /** 
         * fill the field : dc_device.token_time
         * @param tokenTime 设备令牌创建的时间戳,每次创建设备令牌都会修改此字段
         * @see DeviceBean#getTokenTime()
         * @see DeviceBean#setTokenTime(java.util.Date)
         */
        public Builder tokenTime(java.util.Date tokenTime){
            TEMPLATE.get().setTokenTime(tokenTime);
            return this;
        }
        /** 
         * fill the field : dc_device.screen_info
         * @param screenInfo 设备屏幕信息,格式示例:15H1080x960--15(英)寸横屏分辨率1080x960,21V960x1080--21(英)寸横屏分辨率960x1080
         * @see DeviceBean#getScreenInfo()
         * @see DeviceBean#setScreenInfo(String)
         */
        public Builder screenInfo(String screenInfo){
            TEMPLATE.get().setScreenInfo(screenInfo);
            return this;
        }
        /** 
         * fill the field : dc_device.os_arch
         * @param osArch 操作系统名称及版本及硬件架构名称,例如:Windows-x86_64,Linux-x86_64,Android-arm...
         * @see DeviceBean#getOsArch()
         * @see DeviceBean#setOsArch(String)
         */
        public Builder osArch(String osArch){
            TEMPLATE.get().setOsArch(osArch);
            return this;
        }
        /** 
         * fill the field : dc_device.version_info
         * @param versionInfo 设备端应用程序的版本号,格式由应用层定义
         * @see DeviceBean#getVersionInfo()
         * @see DeviceBean#setVersionInfo(String)
         */
        public Builder versionInfo(String versionInfo){
            TEMPLATE.get().setVersionInfo(versionInfo);
            return this;
        }
        /** 
         * fill the field : dc_device.model
         * @param model 设备产品型号
         * @see DeviceBean#getModel()
         * @see DeviceBean#setModel(String)
         */
        public Builder model(String model){
            TEMPLATE.get().setModel(model);
            return this;
        }
        /** 
         * fill the field : dc_device.vendor
         * @param vendor 设备供应商
         * @see DeviceBean#getVendor()
         * @see DeviceBean#setVendor(String)
         */
        public Builder vendor(String vendor){
            TEMPLATE.get().setVendor(vendor);
            return this;
        }
        /** 
         * fill the field : dc_device.device_detail
         * @param deviceDetail 设备产品详细信息,以JSON格式定义设备详细信息,JSON字段:device_name(产品名称),manufacturer(制造商),made_date(生产日期),应用层可根据需要扩展
         * @see DeviceBean#getDeviceDetail()
         * @see DeviceBean#setDeviceDetail(String)
         */
        public Builder deviceDetail(String deviceDetail){
            TEMPLATE.get().setDeviceDetail(deviceDetail);
            return this;
        }
        /** 
         * fill the field : dc_device.props
         * @param props JSON格式的扩展字段(最大64KB),用于定义扩展信息
         * @see DeviceBean#getProps()
         * @see DeviceBean#setProps(String)
         */
        public Builder props(String props){
            TEMPLATE.get().setProps(props);
            return this;
        }
        /** 
         * fill the field : dc_device.remark
         * @param remark 备注
         * @see DeviceBean#getRemark()
         * @see DeviceBean#setRemark(String)
         */
        public Builder remark(String remark){
            TEMPLATE.get().setRemark(remark);
            return this;
        }
        /** 
         * fill the field : dc_device.create_time
         * @param createTime 
         * @see DeviceBean#getCreateTime()
         * @see DeviceBean#setCreateTime(java.util.Date)
         */
        public Builder createTime(java.util.Date createTime){
            TEMPLATE.get().setCreateTime(createTime);
            return this;
        }
        /** 
         * fill the field : dc_device.update_time
         * @param updateTime 
         * @see DeviceBean#getUpdateTime()
         * @see DeviceBean#setUpdateTime(java.util.Date)
         */
        public Builder updateTime(java.util.Date updateTime){
            TEMPLATE.get().setUpdateTime(updateTime);
            return this;
        }
    }
}
